package com.vincent.template.domain;

import com.vincent.template.commons.base.BaseUuidEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import java.util.Date;

/**
 * 用户
 * @Author Vincent Wang
 * @Date 2020/10/16 14:56
 */
@Entity
@Table(name = "sys_user",
        uniqueConstraints = {@UniqueConstraint(name = "phone_unique", columnNames = {"phone"}), @UniqueConstraint(name = "username_unique", columnNames = {"userName"})},
        indexes = {@Index(name = "username_password_idx", columnList = "username,password")})
public class SysUserPo extends BaseUuidEntity {

    /**
     * 用户名
     */
    @Column(nullable = false, length = 64)
    private String username;

    /**
     * 加密后的密码
     */
    @Column(nullable = false, length = 32)
    private String password;

    /**
     * 手机号
     */
    @Column(length = 20)
    private String phone;

    /**
     * 邮箱
     */
    @Column(length = 64)
    private String email;

    /**
     * 生日
     */
    @Column(columnDefinition = "date default null")
    private Date birthday;

    /**
     * 性别
     * MALE：男 FEMALE：女 HIDDEN：保密
     */
    @Column(length = 6)
    private String sex;

    /**
     * 地址
     */
    @Column(length = 128)
    private String address;

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}
